<template>
  <a-drawer
    :maskClosable="false"
    :title="title"
    :width="width"
    placement="right"
    :closable="false"
    @close="close"
    :visible="visible">
    <erp-omc-tender-result-form ref="realForm" @ok="submitCallback" @unButtonDisable="unButtonDisable" :disabled="disableSubmit" normal></erp-omc-tender-result-form>
    <div class="drawer-footer">
      <CommonDrawerFooterButton
        startProcess="erpOmcTenderResult: startProcess"
        :disableSubmit="disableSubmit"
        :buttonDisable="buttonDisable"
        @handleCancel="handleCancel"
        @handleOk="handleOk"
        @beginProcess="beginProcess"
      ></CommonDrawerFooterButton>
    </div>
  </a-drawer>
</template>

<script>

  import ErpOmcTenderResultForm from './ErpOmcTenderResultForm'
  import CommonDrawerFooterButton from '@/views/components/CommonDrawerFooterButton.vue';
  import { ModalClickMixin } from '@/mixins/ModalClickMixin'
  export default {
    name: 'ErpOmcTenderResultModal',
    components: {
      ErpOmcTenderResultForm,
      CommonDrawerFooterButton
    },
    mixins: [ModalClickMixin],
    methods: {
      submitCallback(type, record) {
        this.$emit('ok', type, record);
      if (type == 'draft') {
        this.visible = false;
      }
        // 修改是否修改自编数据状态
        this.$refs.realForm.refresh = false;
      },
      handleOk () {
        this.buttonDisable = true;
        this.$refs.realForm.submitForm('draft');
        // 修改是否修改自编数据状态
        this.$refs.realForm.refresh = false;
      },
      // 点击发起流程
      beginProcess () {
        this.buttonDisable = true;
        this.$refs.realForm.submitForm('submit');
        // 修改是否修改自编数据状态
        this.$refs.realForm.refresh = false;
      },
      handleCancel () {
        this.close()
        // 修改是否修改自编数据状态
        this.$refs.realForm.refresh = false;
      }
    }
  }
</script>

<style lang="less" scoped>
/** Button按钮间距 */
  .ant-btn {
    margin-left: 30px;
    margin-bottom: 30px;
    float: right;
  }
  .drawer-footer{
    position: absolute;
    bottom: -8px;
    width: 100%;
    border-top: 1px solid #e8e8e8;
    padding: 10px 16px;
    text-align: right;
    left: 0;
    background: #fff;
    border-radius: 0 0 2px 2px;
    z-index: 100;
  }
</style>
